using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using Ghasam.Business.Services;

public partial class InternalAccountingPage : System.Web.UI.Page
{
    private IInternalAccountingService internalAccountingService;

    public IInternalAccountingService InternalAccountingService
    {
        get { return internalAccountingService; }
        set { internalAccountingService = value; }
    }

    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            GetInternalAccountings(0, true);
        }
    }

    private void GetInternalAccountings(int pageNumber, bool setPageCount)
    {
        if (setPageCount)
            gvInternalAccountings.VirtualItemCount = internalAccountingService.GetCount();

        gvInternalAccountings.DataSource = internalAccountingService.GetAll(15, pageNumber);
        gvInternalAccountings.DataBind();
    }

    protected void gvInternalAccountings_PageIndexChanging(object sender, GridViewPageEventArgs e)
    {
        gvInternalAccountings.PageIndex = e.NewPageIndex;
        GetInternalAccountings(e.NewPageIndex, false);
    }
}
